home *** CD-ROM | disk | FTP | other *** search
/ Young Minds / Young Minds Interactive CD-ROM.ISO / mpss / processi.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-07-20  |  16.0 KB  |  623 lines

  1.  
  2. /*******************************************************************************
  3. ********************************************************************************
  4. ********************************************************************************
  5.  
  6. PERMISSION TO COPY THIS SOFTWARE IS HEREBY GIVEN BY THE AUTHOR PROVIDED THAT
  7. THIS LEADING MESSAGE IS INCLUDED IN ALL OF THE RELEVANT SOURCE FILES.
  8.  
  9.         P. SCHMITZ, UNIVERSITY OF KEELE, MAY 1988.
  10.  
  11.  
  12. ********************************************************************************
  13. ********************************************************************************
  14. *******************************************************************************/
  15.  
  16. #include "header.h"
  17. #include "ships.h"
  18.  
  19. processinput(cp,ptrnoofchars)
  20. register struct player *cp;
  21. long *ptrnoofchars;
  22. {
  23. register struct player *x,*o;
  24. int z;
  25. unsigned char c;    /* override "char c" in header.h  -- br */
  26.  
  27. getbuf(cp,ptrnoofchars);
  28. while ((c=getchr(cp))!='\0')
  29. {
  30.     if (c=='+')
  31.           {
  32.     plot1(cp,"Self Destruct Activated!!!!!!!!!!!!! Abandon Ship........");
  33.     plot2(cp,"Abandon Ship..Abandon Ship..Abandon Ship...........Aaargh");
  34.           if (cp->reason>0) cp->reason= -3;
  35.           finish(cp);
  36.           continue;
  37.           }
  38.     if (c=='G')
  39.           { if (cp->beeping) 
  40.             {
  41.             cp->beeping=OFF;
  42. plot1(cp,"                  Beep switched off.                     ");
  43. plot2(cp,"                                                         ");
  44.             }
  45.             else     
  46.             {
  47.             cp->beeping=ON;
  48. plot1(cp,"                  Beep switched on.                      ");
  49. plot2(cp,"                                                         ");
  50.             beep(cp);
  51.             }
  52.            continue;
  53.            }
  54. if (((c=='?'))&&(cp->stat!=0)&&(cp->stat!=1)&&(cp->stat!=6)&&(cp->stat<9)&&(cp->stat!=5))
  55.         {
  56.         cp->xvel=0;
  57.         cp->yvel=0;
  58.         cp->oldstat=cp->stat;
  59.         plotstatus(cp,11);
  60.         display_sheet(cp);
  61.         continue;
  62.         }
  63.  
  64.  
  65. if ((cp->stat==11)||(cp->stat==10))
  66.         {
  67.         drawcross(cp);
  68.         if (cp->stat==10) {
  69.                     updateship(cp);
  70.                     cp->score+=10;
  71.                     plotscore(cp);
  72.                 }
  73.         plotstatus(cp,cp->oldstat);
  74.         continue;
  75.         }
  76.  
  77. if (cp->stat==1)
  78.     {
  79.     if ((c!='\n') && (cp->messindex<6))
  80.         {
  81.         cp->message[cp->messindex]=c;
  82.         poscurs(cp,(69+cp->messindex),22);
  83.         write(cp->fd,&c,1);
  84.         ++(cp->messindex);
  85.         continue;
  86.         }
  87.         else
  88.         {
  89.         c=cp->message[0];
  90.         if (c==ROMID || c==(ROMID+32))
  91.             {
  92.     plot1(cp,"       Since when do Romulan ships have prefix codes?    ");
  93.     plot2(cp,"                                                         ");
  94.             plotstatus(cp,cp->oldstat);
  95.             continue;
  96.             }
  97.         if (c==KLINGID || c==(KLINGID+32))
  98.             {
  99.     plot1(cp,"       Since when do Klingon ships have prefix codes?    ");
  100.     plot2(cp,"                                                         ");
  101.             plotstatus(cp,cp->oldstat);
  102.             continue;
  103.             }
  104.         x=startlist;
  105.         o=NULL;
  106.         while (x!=NULL) 
  107.         {
  108.         if ((c==x->id)||(c==(char)(x->id+32)))
  109.                 {
  110.                 o=x;
  111.                 x=NULL;
  112.                 } else
  113.                 x=x->next;
  114.         }
  115.         if (o==NULL)
  116.             {
  117.     plot1(cp,"       Uhura : Unknown destination ship sir.             ");
  118.     plot2(cp,"       (The player probably died recently.)              ");
  119.             plotstatus(cp,cp->oldstat);
  120.             continue;
  121.             } else
  122.         {
  123.         j=1;
  124.         for (i=0;i<5;++i)
  125.         if (cp->message[j]!=ship[o->shipno].prefixcode[i]) j=15; 
  126.                                 else ++j;
  127.         if ((o->shipno)>24) {i=15; j=15;}
  128.         if (j==15)
  129.         {
  130.     if (i!=15)
  131.     {
  132.     plot1(cp,"        Uhura : That prefix code didn't work sir.        ");
  133.     plot2(cp,"        We must have the wrong combination......         ");
  134.     } else
  135.     {
  136.     plot1(cp,"      Spock : We cannot lower the shields of this        ");
  137.     plot2(cp,"    alien vessel, as it does not have a prefix code.     ");  
  138.     }
  139.             plotstatus(cp,cp->oldstat);
  140.             continue;
  141.         } else
  142.         {
  143.     plot1(cp,"       Uhura : prefix code sent sir.                     ");
  144.     plot2(cp,"       Spock : It seems to work sir.                     "); 
  145.     plot1(o,"Spock : Our shields and cloaking device are dropping.... ");
  146.     plot2(o,"   It looks like our ship received its prefix code!      "); 
  147.         o->cloakingdevice=OFF;
  148.         o->shields=OFF;
  149.         if (o->id<72) o->id=(char)(o->id+32);
  150.         plotshields(o);
  151.         plotcloakingdevice(o);
  152.         if (o->stat<12) o->chflg=FLAG;
  153.         plotstatus(cp,cp->oldstat);
  154.         continue;
  155.         }
  156.          }
  157.     }
  158. }
  159.  
  160. if (cp->stat==0)
  161.     {
  162.     if ((c!='\n') && (cp->messindex<57))
  163.         {
  164.         cp->message[cp->messindex]=c;
  165.         poscurs(cp,(20+cp->messindex),22);
  166.         write(cp->fd,&c,1);
  167.         ++(cp->messindex);
  168.         continue;
  169.         }
  170.         else
  171.         {
  172.         c=cp->message[0];
  173.     if ((c==(ROMID+32))||(c==(KLINGID+32))||(c==ROMID)||(c==KLINGID))
  174.             {
  175.     plot1(cp,"     Uhura : I cannot contact enemy captain.             ");
  176.     plot2(cp,"     They are jamming all frequencies.......             ");
  177.             plotstatus(cp,cp->oldstat);
  178.             continue;
  179.             }
  180.         x=startlist;
  181.         o=NULL;
  182.         while (x!=NULL) 
  183.         {
  184.         if ((c==x->id)||(c==(char)(x->id+32)))
  185.                 {
  186.                 o=x;
  187.                 x=NULL;
  188.                 } else
  189.                 x=x->next;
  190.         }
  191.         if (o==NULL)
  192.             {
  193.     plot1(cp,"       Uhura : Unknown destination ship sir.             ");
  194.     plot2(cp,"       (The player probably died recently.)              ");
  195.             plotstatus(cp,cp->oldstat);
  196.             continue;
  197.             } else
  198.         {
  199.     plot1(cp,"             Uhura : Message sent sir.                   ");
  200.     plot2(cp,"                                                         ");
  201.     plot1(o," Uhura : Message from the                                ");
  202.     poscurs(o,46,21);
  203.     write(o->fd,ship[cp->shipno].name,27);
  204.     poscurs(o,70,21);
  205.     write(o->fd,"(",1);
  206.     c=cp->id;
  207.     if ((c>=65)&&(c<=90)) c+=32;
  208.     poscurs(o,71,21);
  209.     write(o->fd,&c,1);
  210.     poscurs(o,72,21);
  211.     write(o->fd,")",1);
  212.     cp->message[0]=' ';
  213.     plot2(o,cp->message);
  214.     plotstatus(cp,cp->oldstat);
  215.     continue;
  216.         }
  217.     }
  218. }
  219.         
  220. if (cp->stat==9)
  221.     {
  222.     if (c=='S') {drawcross(cp); plotstatus(cp,cp->oldstat); continue;}
  223.     if ((c>=97)&&(c<=128)) 
  224.     {
  225.     o=NULL;
  226.     x=startlist;
  227.     while (x!=NULL)
  228.     {
  229.     if ((c==x->id)||(c==((char)(x->id)+32)))
  230.         {
  231.         o=x;
  232.         x=NULL;
  233.         } else x=x->next;
  234.     }
  235.     if (o==NULL)
  236.         {
  237.     plot1(cp,"       There is no such ship in scanning range.          ");
  238.     plot2(cp,"       Scan cancelled. Use 'S' to abort Scan.            ");
  239.         continue;
  240.         } else
  241.     {
  242.     if ((o->id!=ROMID)&&(o->id!=KLINGID)&&(o->shields))
  243.         {
  244.     plot1(cp,"       We cannot scan through another ships shields.     ");
  245.     plot2(cp,"           Scan cancelled. Use 'S' to abort Scan.        ");
  246.         }
  247.         else scan(cp,o);
  248.     }
  249.     }
  250.     }
  251. if (cp->stat==6)
  252.     {
  253.     switch (c)
  254.     {
  255.     case '1':lock_on(cp,0); break;
  256.     case '2':lock_on(cp,1); break;
  257.     case '3':lock_on(cp,2); break;
  258.     case '4':lock_on(cp,3); break;
  259.     default:
  260.     plot1(cp,"            Invalid tractor beam number!                 ");
  261.     plot2(cp,"                                                         ");
  262.     break;
  263.     }
  264.     plotstatus(cp,3);
  265.     continue;
  266.     }
  267.  
  268. if (cp->stat==5)
  269.     {
  270.     cp->flyto= -1;
  271.     switch (c) {
  272.     case '1' : cp->flyto=0; break;
  273.     case '2' : cp->flyto=1; break;
  274.     case '3' : cp->flyto=2; break;
  275.     case '4' : cp->flyto=3; break;
  276.     default :
  277.         {
  278. plot1(cp,"                    Invalid Channel number.              ");
  279. plot2(cp,"                    Auto-Pilot Cancelled.                ");
  280.         cp->xvel=0;
  281.         cp->yvel=0;
  282.         cp->flyto= -1;
  283.         plotvelocity(cp);
  284.         plotstatus(cp,3);
  285.         break;
  286.         }
  287.         }
  288. z=cp->flyto;
  289. if ((z>=0)&&(z<=3)&&(cp->channel[z].xloc==0)&&(cp->channel[z].yloc==0)&&(cp->channel[z].enemy==NULL))
  290.         {
  291. plot1(cp,"                 That beam  isn't programmed.            ");
  292. plot2(cp,"                    Auto-Pilot Cancelled.                ");
  293.         cp->xvel=0;
  294.         cp->yvel=0;
  295.         cp->flyto= -1;
  296.         plotvelocity(cp);
  297.         plotstatus(cp,3);
  298.         }
  299.     continue;
  300.     }
  301.  
  302.  
  303. if(((cp->stat>1)&&(cp->stat<5))||(cp->stat==7)||(cp->stat==8))
  304.     {
  305.     switch (c) {
  306.     case 'l':if (cp->stat>6) {move_message(cp); break;} 
  307.         ++(cp->xvel); if (cp->stat<12) cp->chflg=FLAG; 
  308.         checkvelocity(cp); 
  309.         break;
  310.     case 'k':if (cp->stat>6) {move_message(cp); break;} 
  311.         ++(cp->yvel); if (cp->stat<12) cp->chflg=FLAG; 
  312.         checkvelocity(cp); 
  313.         break;
  314.     case 'j':if (cp->stat>6) {move_message(cp); break;} 
  315.         --(cp->yvel); if (cp->stat<12) cp->chflg=FLAG; 
  316.         checkvelocity(cp); break;
  317.     case 'h':if (cp->stat>6) {move_message(cp); break;} 
  318.         --(cp->xvel); if (cp->stat<12) cp->chflg=FLAG; 
  319.         checkvelocity(cp); break;
  320.     case 'y':if (cp->stat>6) {move_message(cp); break;} 
  321.         --(cp->xvel); ++(cp->yvel); if (cp->stat<12) 
  322.         cp->chflg=FLAG; checkvelocity(cp);  break;
  323.     case 'b':if (cp->stat>6) {move_message(cp); break;} 
  324.         --(cp->xvel); --(cp->yvel); if (cp->stat<12) 
  325.         cp->chflg=FLAG; checkvelocity(cp);  break;
  326.     case 'n':if (cp->stat>6) {move_message(cp); break;} 
  327.         ++(cp->xvel); --(cp->yvel); if (cp->stat<12) 
  328.         cp->chflg=FLAG; checkvelocity(cp);  break;
  329.     case 'u':if (cp->stat>6) {move_message(cp); break;} 
  330.         ++(cp->xvel); ++(cp->yvel); if (cp->stat<12) 
  331.         cp->chflg=FLAG; checkvelocity(cp);  break;
  332.     case 's':if (cp->stat>6) {move_message(cp); break;} 
  333.         cp->xvel=0; cp->yvel=0; if (cp->stat<12) 
  334.         cp->chflg=FLAG; checkvelocity(cp); 
  335.         plotvelocity(cp); break;
  336.     case 'L':
  337.         if (cp->xvel!=0 || cp->yvel!=0) {impulse_message(cp); break;}
  338.         if (cp->stat>6) {move_message(cp); break;} 
  339.         cp->xvel=1; 
  340.         cp->impulsemove=1;
  341.         if (cp->stat<12) cp->chflg=FLAG; 
  342.         break;
  343.     case 'H':
  344.         if (cp->xvel!=0 || cp->yvel!=0) {impulse_message(cp); break;}
  345.         if (cp->stat>6) {move_message(cp); break;} 
  346.         cp->xvel= -1; 
  347.         cp->impulsemove=1;
  348.         if (cp->stat<12) cp->chflg=FLAG; 
  349.         break;
  350.     case 'J':
  351.         if (cp->xvel!=0 || cp->yvel!=0) {impulse_message(cp); break;}
  352.         if (cp->stat>6) {move_message(cp); break;} 
  353.         cp->yvel= -1; 
  354.         cp->impulsemove=1;
  355.         if (cp->stat<12) cp->chflg=FLAG; 
  356.         break;
  357.     case 'K':
  358.         if (cp->xvel!=0 || cp->yvel!=0) {impulse_message(cp); break;}
  359.         if (cp->stat>6) {move_message(cp); break;} 
  360.         cp->yvel=1; 
  361.         cp->impulsemove=1;
  362.         if (cp->stat<12) cp->chflg=FLAG; 
  363.         break;
  364.     case 'Y':
  365.         if (cp->xvel!=0 || cp->yvel!=0) {impulse_message(cp); break;}
  366.         if (cp->stat>6) {move_message(cp); break;} 
  367.         cp->xvel= -1; 
  368.         cp->yvel= 1; 
  369.         cp->impulsemove=1;
  370.         if (cp->stat<12) cp->chflg=FLAG; 
  371.         break;
  372.     case 'U':
  373.         if (cp->xvel!=0 || cp->yvel!=0) {impulse_message(cp); break;}
  374.         if (cp->stat>6) {move_message(cp); break;} 
  375.         cp->xvel=1; 
  376.         cp->yvel=1; 
  377.         cp->impulsemove=1;
  378.         if (cp->stat<12) cp->chflg=FLAG; 
  379.         break;
  380.     case 'B':
  381.         if (cp->xvel!=0 || cp->yvel!=0) {impulse_message(cp); break;}
  382.         if (cp->stat>6) {move_message(cp); break;} 
  383.         cp->xvel= -1; 
  384.         cp->yvel= -1; 
  385.         cp->impulsemove=1;
  386.         if (cp->stat<12) cp->chflg=FLAG; 
  387.         break;
  388.     case 'N':
  389.         if (cp->xvel!=0 || cp->yvel!=0) {impulse_message(cp); break;}
  390.         if (cp->stat>6) {move_message(cp); break;} 
  391.         cp->xvel= 1; 
  392.         cp->yvel= -1; 
  393.         cp->impulsemove=1;
  394.         if (cp->stat<12) cp->chflg=FLAG; 
  395.         break;
  396.     case 'p': if (cp->weaponselect==0)
  397.     {
  398.             cp->weaponselect=1;
  399.     plot1(cp,"                                                         ");
  400.     plot2(cp,"           Photon Torpedos ready Captain!!               ");
  401.     }
  402.             else
  403.     {
  404.             cp->weaponselect=0;
  405.     plot1(cp,"           Locking Phasers Captain!                      ");
  406.     plot2(cp,"                                                         ");
  407.     }
  408.           plotphaserbanks(cp);
  409.           plotphotontorpedos(cp);
  410.           break;
  411.         case 'D': if (debug) debug=OFF; else debug=ON;
  412.           break;
  413.     case 'c': { if (cp->cloakingdevice)
  414.             {
  415.             cp->cloakingdevice=OFF;
  416.             }
  417.             else
  418.             {
  419.             if ((which_sector(cp->xpos,cp->ypos,cp->xvel,cp->yvel)==3))
  420.             {
  421.     plot1(cp,"           You are in the Mutara Nebula!!                ");
  422.     plot2(cp,"          Cloaking  Device is inoperative!               ");
  423.             } else
  424.             {
  425.             if (storm)
  426.             {
  427.     plot1(cp,"           That ion storm is still out there.            ");
  428.     plot2(cp,"           We cannot cloak while it's around.            ");
  429.             } else
  430.             {
  431.             if (cp->stat<7)
  432.                 {
  433.                 cp->cloakingdevice=ON;
  434.                 cp->clflg=ON;
  435.                 }
  436.             }
  437.             }
  438.             }
  439.             if (cp->stat<12) cp->chflg=FLAG;
  440.                plotcloakingdevice(cp);
  441.            break;
  442.            }
  443.     case 'z':
  444.         if (cp->stat==8) { beamdown(cp); } else
  445.         {
  446.     plot1(cp,"           We are not in orbit !!                        ");
  447.     plot2(cp,"                                                         ");
  448.         }
  449.         break;
  450.     case 'v': { if (cp->shields)
  451.             {
  452.             cp->shields=OFF;
  453.             cp->id=(char)(cp->id+32);
  454.             }
  455.             else
  456.             {
  457.             if ((which_sector(cp->xpos,cp->ypos,cp->xvel,cp->yvel)==3))
  458.             {
  459.     plot1(cp,"           You are in the Mutara Nebula!!                ");
  460.     plot2(cp,"              Shields are inoperative!                   ");
  461.             } else
  462.             {
  463.             if (cp->stat<7)
  464.                 {
  465.                 cp->shields=ON;
  466.                 cp->id=(char)(cp->id-32);
  467.                 }
  468.             }
  469.             }
  470.             if (cp->stat<12) cp->chflg=FLAG;
  471.                plotshields(cp);
  472.            break;
  473.            }
  474.     case 'W': {
  475.             x=startlist;
  476.     plot1(cp,"Starfleet says that the following ships exist as well :  ");
  477.     plot2(cp,"                                                         ");
  478.             poscurs(cp,30,22);
  479.             while (x!=NULL)
  480.                 {
  481.                 if (x==cp) { x=x->next; continue;}
  482.                 write(cp->fd,&(x->id),1);
  483.                 write(cp->fd,"  ",2);
  484.                 x=x->next;
  485.                 }
  486.           break;
  487.           }
  488.     case 'q': plotposition(cp);
  489.           break;
  490.     case 'a': 
  491.          if (cp->stat>6) {move_message(cp); break;}
  492.           plotstatus(cp,5);
  493.           cp->xvel=0;
  494.           cp->yvel=0;
  495.     plot1(cp,"               Where to? (1,2,3 or 4)                    ");
  496.     plot2(cp,"                                                         ");
  497.           displaybeams(cp);
  498.           plotvelocity(cp);
  499.           break;
  500.     case 't': if ((cp->stat==7)||(cp->stat==8))
  501.             {
  502.             lockmessage(cp);
  503.             break;
  504.             } else
  505.             plotstatus(cp,6); 
  506.     plot1(cp,"   Which tractor beam? (1,2,3 or 4) Currently they are : ");
  507.     plot2(cp,"                                                         ");
  508.           displaybeams(cp);
  509.           break;
  510.     case 'T': 
  511.     plot1(cp,"Tractor beams are currently locked on to the following : ");
  512.     plot2(cp,"                                                         ");
  513.           displaybeams(cp);
  514.           break;
  515.     case 'P':
  516.         cp->oldstat=cp->stat;
  517.         plotstatus(cp,1);
  518.     plot1(cp,"To transmit enemy prefix code type the ships letter      ");
  519.     plot2(cp,"followed by the 5 digit prefix code and return :         ");
  520.     for (i=0;i<57;++i)
  521.         cp->message[i]=' ';
  522.         cp->messindex=0;
  523.         break;
  524.     case 'C':
  525.         cp->oldstat=cp->stat;
  526.         plotstatus(cp,0);
  527.     plot1(cp,"Uhura :Type ship letter & 56 chars (max) message & return");
  528.     plot2(cp,"                                                         ");
  529.     for (i=0;i<57;++i)
  530.         cp->message[i]=' ';
  531.         cp->messindex=0;
  532.         break;
  533.     case 'w': plotvelocity(cp);
  534.           break;
  535.     case 'e': plotenergy(cp);
  536.           break;
  537.     case 'd': if (cp->stat!=7) dock(cp);
  538.           break;
  539.     case 'f': undock(cp);
  540.           break;
  541.     case 'S': 
  542.           cp->xvel=0; cp->yvel=0;
  543.           cp->oldstat=cp->stat;
  544.           plotstatus(cp,9); 
  545. plot1(cp,"               Which Ship ?                              ");
  546. plot2(cp,"                                                         ");
  547.           break;
  548.     case 'o': orbit(cp);
  549.           break;
  550.     case 'i': unorbit(cp);
  551.           break;
  552.     case 'R': cp->oldstat=cp->stat;
  553.           redrawconsole(cp);
  554.           plotstatus(cp,cp->oldstat);
  555.           break;
  556.     case '1': fire_torpedo(cp,c,0); break;
  557.     case '4': fire_torpedo(cp,c,0); break;
  558.     case '7': fire_torpedo(cp,c,0); break;
  559.     case '8': fire_torpedo(cp,c,0); break;
  560.     case '9': fire_torpedo(cp,c,0); break;
  561.     case '6': fire_torpedo(cp,c,0); break;
  562.     case '3': fire_torpedo(cp,c,0); break;
  563.     case '2': fire_torpedo(cp,c,0); break;
  564.     default : 
  565.         {    
  566. plot1(cp,"            That key isn't in use!                       ");
  567. plot2(cp,"                                                         ");
  568.         beep(cp); break;
  569.         }
  570.     } /*switch*/
  571.     } /*if - then*/
  572. } /*while loop*/
  573. }
  574.  
  575. move_message(cp)
  576. register struct player *cp;
  577. {
  578.    if (cp->stat==7)
  579.     {
  580.         plotvelocity(cp);
  581.         plot1(cp,"   You can't move when you're docked captain! Press      ");
  582.         plot2(cp,"   f to undock. Will you ever get the hang of this?      ");
  583.     }
  584.    if (cp->stat==8)
  585.     {
  586.         plotvelocity(cp);
  587.         plot1(cp,"  You can't leave orbit just like that. We need reverse  ");
  588.         plot2(cp," impulse thrusters to get out. Press 'i' to kill  orbit. ");
  589.     }
  590. }
  591.  
  592. impulse_message(cp)
  593. register struct player *cp;
  594. {
  595.         plotvelocity(cp);
  596.         plot1(cp,"   Manoevering Impulse Thrusters only function from      ");
  597.         plot2(cp,"   a stationary position..thrusters are overheated.      ");
  598. }
  599.  
  600. lockmessage(cp)
  601. register struct player *cp;
  602. {
  603.         plot1(cp,"You can't lock tractor beams when you're docked or in    ");
  604.         plot2(cp,"    orbit. Will you ever get the hang of this?           ");
  605. }
  606.  
  607. checkvelocity(cp)
  608. register struct player *cp;
  609. {
  610. if ((abs(cp->xvel)>cp->maxvel)||(abs(cp->yvel)>cp->maxvel))
  611.     {
  612.         plot1(cp,"  Scott to Captain: The dilithium crystals are melting!  ");
  613.         plot2(cp,"       I canna make 'er go faster than that Captain.     ");
  614.         if (abs(cp->xvel)>cp->maxvel)
  615.             {
  616.             if (cp->xvel<0) ++(cp->xvel); else --(cp->xvel);
  617.             } else
  618.             {
  619.             if (cp->yvel<0) ++(cp->yvel); else --(cp->yvel);
  620.             }
  621.     }
  622. }
  623.